package com.lagou.api;

import com.lagou.pojo.User;
import com.lagou.rpc.annotation.RpcService;
import com.lagou.service.IUserService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName UserServiceImpl
 * @Description
 * @Author playboy
 * @Date 2021/6/5 3:26 下午
 * @Version 1.0
 **/
@Service
@RpcService
public class UserServiceImpl implements IUserService {

	private static Map<Integer, User> userList = new HashMap<>();

	static {
		User user = new User();
		user.setId(1);
		user.setName("张三");
		userList.put(user.getId(), user);

		User user1 = new User();
		user1.setId(2);
		user1.setName("李四");
		userList.put(user1.getId(), user1);
	}

	@Override
	public User getById(int id) {
		return userList.get(id);
	}
}
